<%@ include file="/common/taglibs.jsp"%>
<%@ page pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>
增加角色
</title>
<script src="scripts/common.js"></script>
<link href="./styles/layout.css" rel="stylesheet" type="text/css"/>
<link href="<c:url value="/styles/css.css"/>" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #F4F4F4;
}
-->
</style>
<script>


	function formSubmit2(theform,text){
	if(checkMSISDN()){
	document.forms[0].actionflag.value=text;
theform.submit();
}
//parent.rightdownFrame.location.reload();  
	}
	
	function formSubmit3(theform,text){

/*  if(element.value.length<1){
       alert("请先选择要修改的记录！");
       return false;
   }*/
	//if(checkMSISDN()){
	document.forms[0].actionflag.value=text;
theform.submit();
//}
	}

	function delWord(){
		if(!checkIds()){
			alert("请在下面列表中选择要删除的黑名单！");
		}else{
			document.forms[0].actionflag.value="delete";
			document.forms[0].submit();
		}
	}
	
	function checkIds(){
		var elements = document.forms[0].document.getElementsByName("ids");
		var j = 0;
		for(i=0;i<elements.length;i++){
			e = elements[i];
			if(e.checked == true){
				j++;
			}
		}
		if(j>0)
			return true;
		else 
			return false;
	}
	
	
function checkMSISDN(){
//   var element =document.getElementById("msisdn");
//   if(element.value.length<1){
//       alert("手机号不能为空！");
//       return false;
//   }
 
//   var exp=new RegExp("^13\\d{9}$");
//   if(!exp.test(element.value)){
//      alert("手机号码格式不正确！");
//   return false;
//   }
   
   return true;
}

function formSubmitseByID(theform,text,idtxt){
	document.forms[0].idtxt.value=idtxt;
	document.forms[0].actionflag.value=text;
theform.submit(); 
	}
	
	function selectall(){
  var isChecked = document.forms[0].chkall.checked;
  if(document.forms[0].length == null){
    document.forms[0].elements[i].checked = isChecked;
    return;
  }
  else{
    for(i=0;i<document.forms[0].length;i++){       
      document.forms[0].elements[i].checked=isChecked;
    }
	return;
  }
} 
</script>
</head>

<body leftmargin="0" topmargin="0">
<html:form action="/roleFuncAction.html?method=addRole"   method="post"> 
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
     <td class="home-content-title" ><img src="images/passenger.gif" width="21" height="22" align="absmiddle"/><fmt:message key="menu.manager.title.roleInfo" />
	  </td>
  </tr>
  <logic:messagesPresent>
		<tr id="messagesPresentTrId" style="display:;">
			<td valign="top" class="black12" height="20">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
					<tr>
						<td class="arror_bg">
							<span class="arror_title">
						     您的操作存在如下错误：<br></span>
						     <html:errors/>
					    </td>
				    </tr>
			    </table>
			</td>
		</tr>
  </logic:messagesPresent>
  <tr id="messageShowTrId" style="display:none;">
	<td valign="top" class="black12">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
	<td class="arror_bg">
	<span class="arror_title"> 
     您的操作存在如下错误：<br/>
     </span>
     <span id="warnSaveMsgSpanId" style="display:none">
      <li>保存失败
     </span>
     <span id="warnExistSpanId" style="display:none">
      <li>该角色已经存在
     </span>
    </td>
    </tr>
    </table>
	</td>
	</tr>
  <tr>
    <td valign="top"> 
      <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td class="home-table-topline"> </td>
        </tr>
        <tr> 
          <td class="home-table-leftline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td class="home-table-tool-content">
				<input  type="button"  class="home-inputBtn" value="<fmt:message key="button.save"/>" onclick="javascript:formSubmit3(document.forms[0],'update');">
                 <input  type="button"  class="home-inputBtn" value="<fmt:message key="button.close"/>" onclick="window.close();"/>
                 </td>
              </tr>
              <tr>
                <td align="center" valign="top">&nbsp;</td>
              </tr>
              <tr> 
                <td valign="top" class="home-edittable-space"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td> <input type="hidden" name="actionflag"/>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
	 
      <tr>
        <td>&nbsp;</td>
       <td class="home-subtable-view-tdstyle-left"><font color="red">*</font><fmt:message key="user.common.role.name"/>：</td>
          <td class="black12" colspan="2">
        	<html:text property="urName" styleClass="home-table-inputbox"/>
        </td>
      <tr>
      	<td>&nbsp;</td>
        <td class="black12"><fmt:message key="user.common.role.desc"/>：</td>
        <td colspan="4" class="home-subtable-view-tdstyle-left">
        	<html:textarea cols="50" rows="6" property="urDescription" styleClass="home-table-inputbox" ></html:textarea>
       </td>
      </tr>
    </table></td>
                    </tr>
                  </table> 
                  
                </td>
              </tr>
            </table>
		  </td>
        </tr>
        <tr> 
          <td height="12">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td class="home-table-bottom-left">&nbsp;</td>
                <td class="home-table-bottom-bg">&nbsp;</td>
                <td class="home-table-bottom-right">&nbsp;</td>
              </tr>
            </table></td>
        </tr>
      </table>
	  
	  </td>
  </tr>
  <tr>
    <td height="10">&nbsp;</td>
  </tr>
</table> 
</html:form>
<script>
	var message = "<c:out value="${message}"/>";
	var messageShowTrId=document.getElementById("messageShowTrId");
 	var messagesPresentTrId=document.getElementById("messagesPresentTrId");
 	var warnSaveMsgSpanId=document.getElementById("warnSaveMsgSpanId");
 	var warnExistSpanId=document.getElementById("warnExistSpanId");
 	
	if(message=="success") {
	 	//alert("保存成功!"); 
	 	window.opener.location.href="roleFuncAction.html?method=getAll";
	 	window.close();
	}else if(message=="failure"){
		//alert("保存失败!");
		if(messageShowTrId!=null)
 			   messageShowTrId.style.display="";
 			if(warnSaveMsgSpanId!=null)
 			   warnSaveMsgSpanId.style.display="";
 			if(messagesPresentTrId!=null&&messagesPresentTrId.style.display=="")
 			   messagesPresentTrId.style.display="none"; 
 			if(warnExistSpanId!=null&&warnExistSpanId.style.display=="")
 			   warnExistSpanId.style.display="none";
	}else if("isExistRoles"==message){
		//alert("该角色已经存在!");
		if(messageShowTrId!=null)
 			   messageShowTrId.style.display="";
 			if(warnExistSpanId!=null)
 			   warnExistSpanId.style.display="";
 			if(messagesPresentTrId!=null&&messagesPresentTrId.style.display=="")
 			   messagesPresentTrId.style.display="none";
 			if(warnSaveMsgSpanId!=null&&warnSaveMsgSpanId.style.display=="")
 			   warnSaveMsgSpanId.style.display="none";
	}
</script>
</body>
</html>